Forum Replies Created
-
AuthorPosts
-
olivier.cornez@me.comParticipant
Hi Carmine,
Thanks I did not know this one.
I was looking at OpenBench LogicSniffer @50EUR but it is a nice comparison and Zeroplus has a lot of protocol available.Thanks again
olivier.cornez@me.comParticipantHey,
Thanks for the info.
You are right I found it.
Up to now I was reading dedicated board manual or HAL related doc.Thanks man
Cheers,
Olivierolivier.cornez@me.comParticipantHi Larry,
I am on a Mac so maybe you should tune a little bit the options.
I tuned it in a terminal until it worked (use cmd with windows): everything is in the openOCD/scripts folder.
I think I’d start without the interface option and see what happens.
once ok update the Eclipse debug configuration.FYI: yesterday I switched to J-Link debugging. I had too many strange behaviour with openOCD. That was too confusing especiallly when you have to learn something new.
So I follow the advanced debugging chapter near the end of the book.
It is very easy, reversible and up to now I do not have any problem with it.Good Luck
olivier.cornez@me.comParticipantHi Carmine,
with a lot of respect for your great work I think it would be nice if you add more details and explanations to I2C chapter 14.
There are a lot of Flags and functions and it was a hard time trying to find docs and samples on ST and NXP websites.Kind Regards,
Olivierolivier.cornez@me.comParticipantOk I found my mistake.
The config pointer as named by Microship ( Register addr) is only 1 byte long.
I was splitting MSB/LSB from the register address to pData[2].So I can read with
Flush_Buffer(pData, sizeof(pData));
for (int i = 0; i < 9; ++i) {
reg = (uint8_t)i;
I2C_Status = HAL_I2C_Master_Transmit(&hi2c1, (uint16_t)MCP9808_DEV_ADDR, (uint8_t*)®, sizeof(reg), HAL_MAX_DELAY);
while(HAL_I2C_IsDeviceReady(&hi2c1, (uint16_t)MCP9808_DEV_ADDR, 1, HAL_MAX_DELAY) != HAL_OK);
I2C_Status = HAL_I2C_Master_Receive(&hi2c1, (uint16_t)MCP9808_DEV_ADDR, (uint8_t*)&pData, sizeof(pData), HAL_MAX_DELAY);
}Let see if I can write 😉
olivier.cornez@me.comParticipantHi,
I hope I do not hurt Carmine by answering your post.
You should be able to run openOCD locally by checking “Start openOCD locally”checkbox on sec5-1-3_fig8.png
Then fill Config options with correct parameters for your board. :
-f interface/stlink-v2-1.cfg -f board/st_nucleo_f4.cfgNote: the -f interface… option is not mandatory.
Then you do not use the openOCD external tool configured but start the debug config. Sometimes it does not work and you must disconnect the board from usb and reconnect it.
Good luck.
olivier.cornez@me.comParticipantAs far as understand is related to msg array being out of scope when using interlocks.
If you move the msg[30] to a global scope then it works fine for me.
Note: I was also getting wrong info from the debugger not flashing the firmware on restart.olivier.cornez@me.comParticipantHi Carmine,
I am using openOCD 0.10 and gcc 5.4 and st-link v2.1 (updated as per book instruction).
Thanks for the info I will check advanced debugging chapter.PS: this weekend I started writing I2C scanner and MCP9808 (temp sensor) application by myself and surprised myself because I was not looking in the book every 5 minutes.
So thanks again for your book you reach your target 😉olivier.cornez@me.comParticipantFound it thanks 😉
hi2c->Instance->DR = I2C_7BIT_ADD_WRITE(DevAddress);
olivier.cornez@me.comParticipantInstalling on Sierra seems a little bit not user friendly but … do not forget OS X is just UNIX so
Open a terminal go to the folder where SetupSTM32CubeMX-4.19.0 is located likecd ˜/Desktop/en/SetupSTM32CubeMX-4.19.0.app
cd MacOS
sudo SetupSTM32CubeMX-4_19_0_macos
type enter and follow with the wizard as usual.on a fresh macOS Sierra you probably need to install java JDK 8 Update 121.pkg. At least for Eclipse Neon 2 Install
Enjoy 😉
olivier.cornez@me.comParticipantOk Thanks.
If I debug step by step I should be able to find where in the HAL it is done. Correct?
olivier.cornez@me.comParticipantHi,
As far as I understand the problem comes with the msg.
If it stores only 1 character as in your book example it works fine but if I change the message then I get strange output like thisWelcome to the Nucleo management console
Select the option you are interested in:
.1. Toggle LD2 LED
.2. Read USER BUTTON status
.3. Clear screen and print this message
Selection: > You sele….Ë…∫…Ë›..
Selection: > Yo….ˇˇ….Ë…….Ë›..
Selection: > Yo….ˇˇ….Ë…….Ë›P.
Selection: > You sele….Ë…….Ë›..
Selection: > Yo..˘ˇˇˇˇ…Ë……….
Selection: >uint8_t processUserInput(uint8_t opt) {
char msg[30];if(!(opt >= 1 && opt <= 3))
return 0;//sprintf(msg, “%d”, opt);
sprintf(msg, “You selected option %d\r\n”, opt);UART_Transmit(&huart2, (uint8_t*)msg, strlen(msg));
switch(opt) {
case 1:
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_5);
break;
case 2:
sprintf(msg, “\r\nUSER BUTTON status: %s”, HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_13) == GPIO_PIN_RESET ? “PRESSED” : “RELEASED”);As far as I understand if the UART is not HAL_BUZY the UART_Transmit() directly the first char while if HAL_BUZY it stores the string in the txBuf.
After that point I am not sure…
What is going on with the next call tovoid HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart){
//trace_puts(“UART Tx IT Complete\n”);
if(RingBuffer_GetDataLength(&txBuf) > 0){
RingBuffer_Read(&txBuf, &txData, 1);
HAL_UART_Transmit_IT(huart, &txData, 1);
}
}Could you clarify this to help?
Thank you so much
olivier.cornez@me.comParticipantI am using the example from the book with the ringBuffer.
right now I modified the code to use only once the UART_Transmit function for the prompt and it seems to work.
But if I use several call s to UART_Transmit inside the processInput() then I get strange outputsolivier.cornez@me.comParticipantYes terminal speed matches (115200 – 8 – 1 – N default setup from CubeMX)
The HAL_UART_Transmit works fine, the Receive_IT works fine but only HAL_UAT_Transmit_IT produces strange outputs.olivier.cornez@me.comParticipantHi Carmine,
Playing with interrupts and chap7 I realised CubeMX did not set the PULLDOWN resistor for the User button on my L152RE.
While it is correctly described in your book I do not understand why ST skip it.
First time I saw his I thought maybe they add a resistance on the board but playing with interrupts proved I was wrong and of course the IRQ seemed very weird during debug.Maybe it would be nice to add a tip into the cubemx section of the book.
Kind regards,
Olivier -
AuthorPosts