---
title: "WizFi360 with SPI, sending CMD command like AT"
url: "https://maker.wiznet.io/forum/14829"
markdown_url: "https://maker.wiznet.io/forum/14829/md"
type: "Forum topic"
category: "Wireless"
author: "lentec"
created: "2023-03-10T12:08:31+09:00"
last_activity: "2023-03-22T15:35:54+09:00"
language: "en"
views: 356
replies: 2
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# WizFi360 with SPI, sending CMD command like AT

## Question

Asked by lentec on 2023-03-10 in Wireless.

I am using WizFi360 with SPI interface. I am reading the answers from WizFi360 correctly. But, when I am sending “AT” command, then I obtain the answer “ERROR”. I think, that I am sending incorect bytes. Can you explain, what means the information on the picture? How can I send AT command in bytes?

[![SPI_CMD](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/2/29599f9eb5b3ebf9689b823aae10f5d6a9919bed.png) SPI_CMD841×549 67 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/2/29599f9eb5b3ebf9689b823aae10f5d6a9919bed.png)

Now I am sending: 0x91 0x04 0x00 0x41 0x54 0x0d 0x0a

## Replies

### Reply 1 by austin, 2023-03-13

Hello [@lentec](https://maker.wiznet.io/u/lentec)

AT CMD Phase should be set in units of 4 bytes.

For example, when sending ‘AT’, the AT CMD Phase should be filled with ‘AT’ and the remaining 2 bytes should be filled with dummy data.

In this case, fill in the CMD Length byte with 4 bytes length information, which is the value of ‘AT’ + dummy data length 2 bytes.

The link below is a WizFi360 SPI example, so please refer to it.

- [GitHub - wizfi/WizFi360-SPI-to-Uart-in-Nucleo](https://github.com/wizfi/WizFi360-SPI-to-Uart-in-Nucleo)

### Reply 2 by lentec, 2023-03-22

I have found this:

WizFi360-SPI-to-Uart-in-Nucleo-master\Src\main.c, lines: 582-587

TX_len = len + 2;

```
if ( TX_len % 4 )
  TX_len = ((TX_len + 3)/4) << 2;
```

and it works on many AT instructions. So, the answer is:

[![SPI_CMD](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/3/354f29f46adca102ad57567f23ed01ac1bc33afd.png) SPI_CMD841×549 68 KB](https://maker.wiznet.io/forum_uploads/wiznet/original/2X/3/354f29f46adca102ad57567f23ed01ac1bc33afd.png)

---

Source: https://maker.wiznet.io/forum/14829
